

package com.hazelcast.client.impl.spi.impl.listener;

import java.util.UUID;

import static com.hazelcast.internal.util.Preconditions.isNotNull;

/**
 * Keeps the information related to to an event registration made by clients.
 */
public class ClientConnectionRegistration {

    private final UUID serverRegistrationId;
    private final long callId;

    ClientConnectionRegistration(UUID serverRegistrationId, long callId) {
        isNotNull(serverRegistrationId, "serverRegistrationId");
        this.serverRegistrationId = serverRegistrationId;
        this.callId = callId;
    }

    /**
     * Alias registration ID is same as registration ID in the beginning. If listener had to be re-registered
     * new registration ID is stored as server registration ID.
     * When user try to remove the listener with registration ID, related server registration is send to
     * subscribed member to remove the listener.
     *
     * @return server registration ID
     */
    public UUID getServerRegistrationId() {
        return serverRegistrationId;
    }


    /**
     * Call ID of first event registration request
     *
     * @return call ID
     */
    long getCallId() {
        return callId;
    }

}
